package com.dtagri.fjwlw.ui.tdvideo;

import java.net.InetAddress;
import java.net.UnknownHostException;

import com.android.nvssdklib.CLIENTINFOR;
import com.android.nvssdklib.NVS_WIFI_PARAM;
import com.android.nvssdklib.NvssdkAPI;
import com.android.nvssdklib.PublicDefine;
import com.dtagri.fjwlw.bean.tdvideo.cls_Channel;
import com.dtagri.fjwlw.bean.tdvideo.cls_Host;
import com.dtagri.fjwlw.ui.VView;



/**
 * 天地伟业
 * 通道类，包含主机和通道实体，还有一些从SDK返回的连接信息。可以被其他的设置和连接公用
 * @author chenpengxiang
 * @version 1.0
 * @created 13-一月-2011 14:18:20
 */
public class CLS_Channel {

	/**
	 * @author chenpengxiang
	 * @version 1.0
	 * @created 13-一月-2011 14:18:20
	 */

	/** 主机信息*/
	private cls_Host m_HostEntity;
	/** 通道信息*/
	private cls_Channel m_ChannelEntity;
	/** 视频连接参数*/
	public CLIENTINFOR m_ClientInfo;
	/** 登录ID*/
	private int m_iLogonID;
	/** 接受数据ID*/
	private int[] m_iulID;
	/** 当前通道的通道号 */
	private int m_iChannelNum;
	/** 当前选中View的编号*/
	private int m_iSelectView;
	/** 当前通道控制步长 */
	private int m_iPTZSpeed = 30;
	/** 云台控制协议 */
	private String m_strPTZController;
	/** 当前连接设备的地址 */
	private int m_iAddress;
	private String 	m_strCommFormat; //m_strDeviceType,
	private String m_strPTZ;
	private String m_strServerIP;
	public VView m_viewObject = null;
	/** 视频流类型（主码流、子码流） */
	private int m_iStreamNO;
	/** 预置位点 */
	private int m_iPreset;
	
	//服务器端口号和客户端端口号
	private int m_iServerPort = 3000, m_iClientPort = 3000;
	//构造函数
 	public CLS_Channel(){
 		m_iLogonID = -1;
 		m_iulID = new int[1];
 		m_ClientInfo = new CLIENTINFOR();
	}
 	
	public int getM_iPreset() {
		return m_iPreset;
	}
	public void setM_iPreset(int m_iPreset) {
		this.m_iPreset = m_iPreset;
	}
	
 	/** 获得控制协议 */
 	public String GetPTZController()
 	{
 		return m_strPTZController;
 	}
 	/** 设置控制协议 */
 	public void SetPTZController(String _strPTZController)
 	{
 		m_strPTZController = _strPTZController;
 	}
 	/** 设置视频流类型（子码流、主码流） */
 	public void SetStreamNO(int _iStreamNO)
 	{
 		m_iStreamNO = _iStreamNO;
 	}
 	/** 获得视频流类型（子码流、主码流） */
 	public int GetStreamNO()
 	{
 		return m_iStreamNO;
 	}
 	/** 设置串口 */
 	/** 获得云台控制速度 */
 	public int GetPTZSpeed()
 	{
 		return m_iPTZSpeed;
 	}
 	/** 设置登录服务器IP */
 	public void SetServerIP(String _strServerIP)
 	{
 		m_strServerIP = _strServerIP;
 	}
 	/** 设置主机信息*/
 	public void SetHostEntity(cls_Host _clsHost)
 	{
 		m_HostEntity = _clsHost;
 	}
 	/** 获取主机信息*/
 	public cls_Host GetHostEntity()
 	{
 		return m_HostEntity;
 	}
 	/** 设置通道信息*/
 	public void SetChannelEntity(cls_Channel _clsChannel)
 	{
 		m_ChannelEntity = _clsChannel;

 	}
 	/** 获得通道信息*/
 	public cls_Channel GetChannelEntity()
 	{
 		return m_ChannelEntity;
 	}
 	/** 设置通道号*/
 	public void SetChannelNum(int _iChannelNum)
 	{
 		m_iChannelNum = _iChannelNum;
 	}
 	/** 获得通道号 */
 	public int GetChannelNum()
 	{
 		return m_iChannelNum;
 	}
 	/** 获得通道号 */
 	public int GetComportEx(int _iComport)  //扩展 ，用于修改NVR控制
 	{
 		int[] iType = new int[1];
 		iType[0] = -1;
 		NvssdkAPI.GetInstance().NetClient_GetProductType(m_iLogonID,iType);
 		iType[0] &= 0xFFFF;
 		if( iType[0] == Public_DeviceType.TC_1002S2_3C )  //为NVR时
 		{
 			return (m_iChannelNum + 256);
 		}
 		else
 		{
 			return _iComport;
 		}
 	}
 	/** 获得登录ID*/
 	public int GetLogonID()
 	{
 		return m_iLogonID;
 	}
 	/** 设置登录ID*/
 	public void SetLogonID(int _iLogonID)
 	{
 		m_iLogonID = _iLogonID;
 	}
 	/** 获得视频显示ID*/
 	public int GetulID()
 	{
 		return m_iulID[0];
 	}
 	public void SetulID(int _iulID)
 	{
 		m_iulID[0] = _iulID;
 	}

 	/** 设置云台控制速度即控制步长 */
 	public void SetPTZSpeed(int _iPTZSpeed)
 	{
 		m_iPTZSpeed = _iPTZSpeed;
 	}
	/** 设置设备地址 */
 	public void SetDeviceAddress()
 	{
 		m_iAddress = m_ChannelEntity.getControlAddress();
 		m_strCommFormat = m_ChannelEntity.getProtocol()+",n,8,1";
 		
 		if(m_ChannelEntity.getPTZType() == PublicDefine.DOME_PELCO_P)
 		{
 			m_strPTZ = "DOME_PELCO_P";
 		}
 		else if(m_ChannelEntity.getPTZType() == PublicDefine.DOME_PELCO_D)
 		{
 			m_strPTZ = "DOME_PELCO_D";
 		}
 		else
 		{
 			m_strPTZ = "DOME_TIANDY";
 		}
 	}
 	/** 获得设备地址 */
 	public int GetDeviceAddress()
 	{
 		return m_ChannelEntity.getControlAddress()-1;
 	}
 	
 	/** 设置串口参数*/
 	private boolean SetSerialParam()
 	{
 		int i = NvssdkAPI.GetInstance().NetClient_SetComFormat(m_iLogonID,	m_ChannelEntity.getComNumber()+1, m_strPTZ, m_strCommFormat, 2/*透明通道*/);
 		if(i != 0)
 			return false;
 		return true;
 	}
 	/** 云台控制 */
 	public boolean PTZControl(int _iActionType)
 	{
 		SetDeviceAddress();
		//int iRet = NvssdkAPI.GetInstance().NetClient_SetDeviceType(m_iLogonID, m_ChannelEntity.getChannelNo(), m_ChannelEntity.getComNumber(), GetDeviceAddress(), m_strPTZ);
 		//iRet = NvssdkAPI.GetInstance().NetClient_SetComFormat( m_iLogonID, m_ChannelEntity.getComNumber(), m_strPTZ, m_strCommFormat,2);
		int iRet = NvssdkAPI.GetInstance().NetClient_DevicePTZCtrl(m_iLogonID, m_ChannelEntity.getPTZType(), _iActionType, m_ChannelEntity.getComNumber(), GetDeviceAddress(), m_iPTZSpeed,m_iPreset);
		return true;
 	}
	/** 云台3D控制 */
 	public boolean PTZ3DControl(int[] _iDecbuf, int _iCount, int _iComPort)
 	{
 		
 		int iComport = _iComPort;
 		if(SetSerialParam());
 		{
	 		//此处第四个参数为串口号。。。
 			iComport = GetComportEx(_iComPort);  //根据NVR判断是哪一个串口
	 		if(NvssdkAPI.GetInstance().NetClient_ComSend(m_iLogonID, _iDecbuf, _iCount, iComport) == 0)
	 			return true;
	 		else
	 			return false;
 		}

 	}
 	public boolean IsTurnMode() //是否是主动模式
 	{
 		return (m_HostEntity.getConnectTypeID() == 1)?true:false;
 	}
 	
 	/** 登录 */
 	public int Logon()
 	{
 		
// 		if(m_HostEntity.getConnectTypeID() == 1)
// 			return TureLogon();
// 		if(m_HostEntity.getConnectTypeID() == 2)
// 		{
// 			return LogonByDNS();
// 		}
 		return IPLogon();
 	}
	/** IP登录*/
	public int IPLogon()
	{
		int iLogon = NvssdkAPI.GetInstance().NetClient_Logon("", m_HostEntity.getConnectIP(), m_HostEntity.getUserName(), m_HostEntity.getPassword(), 
				"", m_HostEntity.getConnectPort());
		if(iLogon >= 0)
		{
			m_iLogonID = iLogon;
			return m_iLogonID;
		}
		else
			return -1;
	}
	public int TureLogon()
	{
		int iLogon = NvssdkAPI.GetInstance().NetClient_TurnLogon(m_HostEntity.getConnectIP(), m_HostEntity.getConnectPort(), m_HostEntity.getDeviceID().toUpperCase());
		if(iLogon >= 0)
		{
			m_iLogonID = iLogon;
			return m_iLogonID;
		}
		else
			return -1;
	}
	public int LogonByDNS()
	{
		int iReturn = 0;
		 
		for(int i = 0; i < m_HostEntity.getDomainName().length(); i++)
		{
			if (m_HostEntity.getDomainName().substring(i, i + 1).equals("@"))
			{
				iReturn = 1;
				break;
			}
		}
		
		if (m_HostEntity.getDomainName().length() > 11) 
		{
			if (m_HostEntity.getDomainName().substring(m_HostEntity.getDomainName().length() - 11, m_HostEntity.getDomainName().length()).equals(".tiandy.com")) 
			{
				if (iReturn != 1) 
				{
					iReturn = 2;
				}
			}
		}
		
		if(iReturn == 1)
		{
			String strDoamin = m_HostEntity.getDomainName().substring(0, m_HostEntity.getDomainName().indexOf("@"));
			String strIP = m_HostEntity.getDomainName().substring(m_HostEntity.getDomainName().indexOf("@") + 1);
			
			InetAddress inet = null;
			try 
			{
				inet = InetAddress.getByName(strIP);
			} 
			catch (UnknownHostException e) 
			{
				e.printStackTrace();
				return -1;
			}		
			strIP = inet.getHostAddress().toString();
			
			int iLogon = NvssdkAPI.GetInstance().NetClient_TiandyDomainLogon(strIP, m_HostEntity.getConnectPort(), strDoamin, m_HostEntity.getUserName(), m_HostEntity.getPassword());
			if(iLogon >= 0)
			{
				m_iLogonID = iLogon;
				return m_iLogonID;
			}
			else
				return -1;
		}
		else if(iReturn == 2)
		{
			String strDoamin = m_HostEntity.getDomainName().substring(0, m_HostEntity.getDomainName().length() - 11);
			
			int iLogon = NvssdkAPI.GetInstance().NetClient_TiandyDomainLogon("221.238.227.86", m_HostEntity.getConnectPort(), strDoamin, m_HostEntity.getUserName(), m_HostEntity.getPassword());
			if(iLogon >= 0)
			{
				m_iLogonID = iLogon;
				return m_iLogonID;
			}
			else
				return -1;
		}
		else
		{
			InetAddress inet = null;
			try {
				inet = InetAddress.getByName(m_HostEntity.getDomainName());
			} catch (UnknownHostException e) {
				e.printStackTrace();
				return -1;
			}		
			String str = inet.getHostAddress().toString();
			
			int iLogon = NvssdkAPI.GetInstance().NetClient_Logon("", str, m_HostEntity.getUserName(), m_HostEntity.getPassword(), 
					"", m_HostEntity.getConnectPort());
			if(iLogon >= 0)
			{
				m_iLogonID = iLogon;
				return m_iLogonID;
			}
			else
				return -1;
		}
	}
	
	/**
	 * 接收到数据后开始播放
	 */
	public boolean StartPlay(int _iSelectView){
		m_iSelectView = _iSelectView;
		m_ClientInfo.m_iChannelNo = m_iChannelNum;
		m_ClientInfo.m_iBufferCount = 5;
		m_ClientInfo.m_iDelayNum = 5;
		m_ClientInfo.m_iDelayTime = 5;
		m_ClientInfo.m_iFlag = 0;
		m_ClientInfo.m_iNetMode = 0;
		m_ClientInfo.m_iPosition = 0;
		m_ClientInfo.m_iServerID = m_iLogonID;
		m_ClientInfo.m_iSpeed = 5;
		m_ClientInfo.m_iStreamNO = m_iStreamNO;
		m_ClientInfo.m_iTimeout = 2000;
		m_ClientInfo.m_iTTL = 8;
		m_ClientInfo.m_strNetFile = "";
		m_ClientInfo.m_strRemoteIP = m_strServerIP;
		
		int[] iCountOfChannel = new int[1];
		if(NvssdkAPI.GetInstance().NetClient_GetChannelNum(m_iLogonID, iCountOfChannel) == 0)
		{
			if(m_iChannelNum > iCountOfChannel[0] - 1)
			{
				return false;
			}
		}

		int iRet = NvssdkAPI.GetInstance().NetClient_StartRecv(m_iulID, m_ClientInfo);
		if(iRet < 0)
		{
			return false;
		}
		NvssdkAPI.GetInstance().NetClient_SetBufferNum(m_iulID[0], 60);
		return true;
	}
	
	
	/**
	 * 设置视频参数
	 */
	/** 获得码流类型  */
	public boolean GetStreamType(int[] _iStreamType, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetStreamType(m_iLogonID, m_iChannelNum, _iStreamType,_iStreamNO)==0)
			return true;
		return false;
	}
	/** 设置码流类型  */
	public boolean SetStreamType(int _iStreamType,int _iStreamNO)  
	{
		if(NvssdkAPI.GetInstance().NetClient_SetStreamType(m_iLogonID, m_iChannelNum, _iStreamType,_iStreamNO)==0)
			return true;
		return false;
		//end alter
	}
	/** 获得视频制式*/
	public boolean GetVideoNPMode(int[] _iVideoZhiShi)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetVideoNPMode(m_iLogonID, _iVideoZhiShi) == 0)
		{
			return true;
		}
		return false;
	}
	/** 设置视频制式*/
	public boolean SetVideoNPMode(int _iVideoZhiShi)
	{
		if(NvssdkAPI.GetInstance().NetClient_SetVideoNPMode(m_iLogonID, _iVideoZhiShi) == 0)
		{
			return true;
		}
		return false;
	}
	/** 获得视频大小 */
	public boolean GetVideoSizeEx(int[] _iVideoSize, int _iStreamNO)
	{
		
		if(NvssdkAPI.GetInstance().NetClient_GetVideoSizeEx(m_iLogonID, m_iChannelNum, _iVideoSize, _iStreamNO) == 0)
		{
			return true;
		}
		return false;
	}
	public boolean GetVideoSize(int[] _iWidth, int[] _iHeight, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetVideoSize(m_iLogonID, m_iChannelNum, _iWidth, _iHeight, _iStreamNO) == 0)
		{
			return true;
		}
		return false;
	}
	/** 设置视频大小 */
	public boolean SetVideoSize(int _iVideoSize, int _iStreamNO) //, boolean _blNeedReboot
	{
		if(NvssdkAPI.GetInstance().NetClient_SetVideoSize(m_iLogonID, m_iChannelNum, _iVideoSize, _iStreamNO) == 0)
		{
			return true;
		}
		return false;
	}
	/** 获得视频质量 */
	public boolean GetVideoQuality(int[] _iVideoQuality, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetVideoQuality(m_iLogonID, m_iChannelNum, _iVideoQuality, _iStreamNO) == 0)
		{
			return true;
		}
		return false;
	}
	/** 设置视频质量 */
	public boolean SetVideoQuality(int _iVideoQuality, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_SetVideoQuality(m_iLogonID, m_iChannelNum, _iVideoQuality, _iStreamNO) == 0)
		{
			return true;
		}
		return false;
	}
	/** 获得编码模式 */
	public boolean GetEncodeMode(int[] _iMode, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetEncodeMode(m_iLogonID, m_iChannelNum, _iStreamNO, _iMode) == 0)
		{
			return true;
		}
		return false;
	}
	/** 设置编码模式 */
	public boolean SetEncodeMode(int _iMode, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_SetEncodeMode(m_iLogonID, m_iChannelNum, _iStreamNO, _iMode) == 0)
		{

			return true;
		}
		return false;
	}
	/** 获得码流限制 */
	public boolean GetMaxKByteRate(int[] _iStreamLimit, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetMaxKByteRate(m_iLogonID, m_iChannelNum, _iStreamLimit, _iStreamNO) == 0)
			return true;
		return false;
	}
	/** 设置码流限制 */
	public boolean SetMaxKByteRate(int _iStreamLimit, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_SetMaxKByteRate(m_iLogonID, m_iChannelNum, _iStreamLimit, _iStreamNO) == 0)
			return true;
		return false;
	}
	/** 获得视频帧率 */
	public boolean GetFrameRate(int[] _iVideoRate, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_GetFrameRate(m_iLogonID, m_iChannelNum, _iVideoRate, _iStreamNO) == 0)
			return true;
		return false;
	}
	/** 设置视频帧率 */
	public boolean SetFrameRate(int _iVideoRate, int _iStreamNO)
	{
		if(NvssdkAPI.GetInstance().NetClient_SetFrameRate(m_iLogonID, m_iChannelNum, _iVideoRate, _iStreamNO) == 0)
		{
			return true;
		}
		return false;
	}
	/** 获得输出端口数 */
	public int GetAlarmOutPortNum()
	{
		int[] iOutPortNum = new int[1];
		int[] iInPortNum = new int[1];
		if(NvssdkAPI.GetInstance().NetClient_GetAlarmPortNum(m_iLogonID, iInPortNum, iOutPortNum) == 0)
		{
			return iOutPortNum[0];
		}
		
		return 0;
	}
	/** 获得报警端口使能 */
	public int GetAlarmOupPortAble(int _iPort)
	{
		int[] iState = new int[1];
		NvssdkAPI.GetInstance().NetClient_GetOutportState(m_iLogonID, _iPort, iState);
		return 	iState[0];
	}
	/** 设置报警端口使能 */
	public boolean SetAlarmOutPortAble(int _iPort, int iState)
	{
		if(NvssdkAPI.GetInstance().NetClient_SetOutportState(m_iLogonID, _iPort, iState) == 0)
		{
			return true;
		}
		return false;
	}
	
	/** 本地图像抓拍 */
	public boolean CapturePicture()
	{
		String strPicPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/";
		if(NvssdkAPI.GetInstance().NetClient_CaptureBmpPic(m_iulID[0], m_HostEntity.getHostName().getBytes(), m_iChannelNum, strPicPath) == 0)
			return true;
		return false;
	}
	/** 前端设备图像抓拍 */
	public boolean SnapshotCapturePicture(){
		if(NvssdkAPI.GetInstance().NetClient_Snapshot(m_iulID[0], m_iChannelNum, 50) == 0)
			return true;
		return false;
	}
	
	/**
	 * 停止预览
	 * */
	public boolean StopPlay(){
		if(NvssdkAPI.GetInstance().NetClient_StopRecv(m_iulID[0]) != 0)
			return false;
		
		if(NvssdkAPI.GetInstance().NetClient_StopPlay(m_iulID[0]) != 0)
			return false;
		for(int i = 0; i < m_viewObject.mPixel.length; i++ )
		{
			m_viewObject.mPixel[i] = (byte)0x00;
		}
		m_viewObject.SetBitmap();
		return true;
	}
	/**
	 * 服务器重启，执行相应收尾工作
	 * */
	public boolean ServerReset()
	{
		NvssdkAPI.GetInstance().NetClient_StopPlay(m_iulID[0]);
//		for(int i = 0; i < m_viewObject.mPixel.length; i++ )
//		{
//			m_viewObject.mPixel[i] = (byte)0x00;
//		}
//		m_viewObject.SetBitmap();
		return true;
	}
	/**
	 * 退出登录
	 * */
	public boolean LogOff()
	{
		if( (m_iLogonID >=0) && (NvssdkAPI.GetInstance().NetClient_Logoff(m_iLogonID) != 0))
			NvssdkAPI.GetInstance().NetClient_Logoff(m_iLogonID);
		return true;
	}
	/**
	 * 重启设备
	 * */
	public boolean Reboot()
	{
		if(NvssdkAPI.GetInstance().NetClient_Reboot(m_iLogonID)==0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	/**
	 * 获得设备类型
	 * */
	public int GetProductType()
	{
		int[] iType = new int[1];
 		iType[0] = -1;
 		NvssdkAPI.GetInstance().NetClient_GetProductType(m_iLogonID,iType);
 		iType[0] &= 0xFFFF;
 		
 		return iType[0];
	}
	
	public int SetWifiParam()
	{
	
		NVS_WIFI_PARAM nvsWifiParam = new NVS_WIFI_PARAM();
		nvsWifiParam.strESSID = "TP-LINK_3G";
		nvsWifiParam.strWifiSvrIP = "192.168.1.35";
		nvsWifiParam.strWifiMask = "255.255.255.0";
		nvsWifiParam.strWifiGateway = "192.168.1.1";
		nvsWifiParam.strWifiDNS = "192.168.1.1";
		nvsWifiParam.strWifiKeyType = "ascii";
		nvsWifiParam.strWifiPassword = "22222222";
		nvsWifiParam.strEncryption = "WPA2-PSK";
		nvsWifiParam.strWifiKeyNum = "2";
		nvsWifiParam.iPwdFormat = 0;
		nvsWifiParam.iHaveCard = 1;
		nvsWifiParam.iCardOnline = 0;
		
		int iRet = NvssdkAPI.GetInstance().NetClient_SetWifiParam(m_iLogonID, nvsWifiParam);
		return iRet;
	}
	public int SetWifiParam1()
	{
	
		NVS_WIFI_PARAM nvsWifiParam = new NVS_WIFI_PARAM();
		nvsWifiParam.strESSID = "chezai";
		nvsWifiParam.strWifiSvrIP = "192.168.1.23";
		nvsWifiParam.strWifiMask = "255.255.255.0";
		nvsWifiParam.strWifiGateway = "192.168.1.1";
		nvsWifiParam.strWifiDNS = "192.168.1.1";
		nvsWifiParam.strWifiKeyType = "ascii";
		nvsWifiParam.strWifiPassword = "22222222";
		nvsWifiParam.strEncryption = "WPA-PSK";
		nvsWifiParam.strWifiKeyNum = "12";
		nvsWifiParam.iPwdFormat = 0;
		nvsWifiParam.iHaveCard = 1;
		nvsWifiParam.iCardOnline = 0;
		
		int iRet = NvssdkAPI.GetInstance().NetClient_SetWifiParam(m_iLogonID, nvsWifiParam);
		return iRet;
	}
	public int Test()
	{
		int[] _iStartType = new int[1];
		int[] _iStopType = new int[1];
		int[] _iDuration = new int[1];

		int iRet = NvssdkAPI.GetInstance().NetClient_Set3GDialog(m_iLogonID, 0,3,0);
		//iRet = NvssdkAPI.GetInstance().NetClient_Get3GDialog(m_iLogonID, _iStartType,_iStopType,_iDuration);
		return iRet;
	}
	public int Set3GDialogStart()
	{
		int iRet = NvssdkAPI.GetInstance().NetClient_Set3GDialog(m_iLogonID, 4,3,100);
		iRet = NvssdkAPI.GetInstance().NetClient_Set3GDialog(m_iLogonID, 0,1,100);
		//iRet = NvssdkAPI.GetInstance().NetClient_Get3GDialog(m_iLogonID, _iStartType,_iStopType,_iDuration);
		return iRet;
	}
	public int Set3GDialogStop()
	{
		int iRet = NvssdkAPI.GetInstance().NetClient_Set3GDialog(m_iLogonID, 4,2,100);
		//iRet = NvssdkAPI.GetInstance().NetClient_Get3GDialog(m_iLogonID, _iStartType,_iStopType,_iDuration);
		return iRet;
	}
	
}